<%@ include file="../common/top.jsp"%>
<div class="crumb">
  <div class="w">
    <div class="crumb-content">
      <a href="main" class="link">MyStore</a>
      <span>></span>
      <span class="link-text">finalView</span>
    </div>
  </div>
</div>

<div class="w panel">
<%--  <div id="BackLink">--%>
<%--    <a href="main">Return to Main Menu</a>--%>
<%--  </div>--%>
  <div class="returnInfo">
    <div class="infoContainer">
      Turn to main page five seconds later...
    </div>
  </div>
  <div id="Catalog">

    <table class="order-table">
      <tr>
        <th align="center" colspan="2">Order #${sessionScope.currentOrder.orderId}
          <fmt:formatDate value="${sessionScope.currentOrder.orderDate}"
                          pattern="yyyy/MM/dd hh:mm:ss" /></th>
      </tr>
      <tr>
        <th colspan="2">Payment Details</th>
      </tr>
      <tr>
        <td>Card Type:</td>
        <td><c:out value="${sessionScope.currentOrder.cardType}" /></td>
      </tr>
      <tr>
        <td>Card Number:</td>
        <td><c:out value="${sessionScope.currentOrder.creditCard}" /> * Fake
          number!</td>
      </tr>
      <tr>
        <td>Expiry Date (MM/YYYY):</td>
        <td><c:out value="${sessionScope.currentOrder.expiryDate}" /></td>
      </tr>
      <tr>
        <th colspan="2">Billing Address</th>
      </tr>
      <tr>
        <td>First name:</td>
        <td><c:out value="${sessionScope.currentOrder.billToFirstName}" /></td>
      </tr>
      <tr>
        <td>Last name:</td>
        <td><c:out value="${sessionScope.currentOrder.billToLastName}" /></td>
      </tr>
      <tr>
        <td>Address 1:</td>
        <td><c:out value="${sessionScope.currentOrder.billAddress1}" /></td>
      </tr>
      <tr>
        <td>Address 2:</td>
        <td><c:out value="${sessionScope.currentOrder.billAddress2}" /></td>
      </tr>
      <tr>
        <td>City:</td>
        <td><c:out value="${sessionScope.currentOrder.billCity}" /></td>
      </tr>
      <tr>
        <td>State:</td>
        <td><c:out value="${sessionScope.currentOrder.billState}" /></td>
      </tr>
      <tr>
        <td>Zip:</td>
        <td><c:out value="${sessionScope.currentOrder.billZip}" /></td>
      </tr>
      <tr>
        <td>Country:</td>
        <td><c:out value="${sessionScope.currentOrder.billCountry}" /></td>
      </tr>
      <tr>
        <th colspan="2">Shipping Address</th>
      </tr>
      <tr>
        <td>First name:</td>
        <td><c:out value="${sessionScope.currentOrder.shipToFirstName}" /></td>
      </tr>
      <tr>
        <td>Last name:</td>
        <td><c:out value="${sessionScope.currentOrder.shipToLastName}" /></td>
      </tr>
      <tr>
        <td>Address 1:</td>
        <td><c:out value="${sessionScope.currentOrder.shipAddress1}" /></td>
      </tr>
      <tr>
        <td>Address 2:</td>
        <td><c:out value="${sessionScope.currentOrder.shipAddress2}" /></td>
      </tr>
      <tr>
        <td>City:</td>
        <td><c:out value="${sessionScope.currentOrder.shipCity}" /></td>
      </tr>
      <tr>
        <td>State:</td>
        <td><c:out value="${sessionScope.currentOrder.shipState}" /></td>
      </tr>
      <tr>
        <td>Zip:</td>
        <td><c:out value="${sessionScope.currentOrder.shipZip}" /></td>
      </tr>
      <tr>
        <td>Country:</td>
        <td><c:out value="${sessionScope.currentOrder.shipCountry}" /></td>
      </tr>
      <tr>
        <td>Courier:</td>
        <td><c:out value="${sessionScope.currentOrder.courier}" /></td>
      </tr>
      <tr>
        <td colspan="1">Status:</td>
        <td> <c:out value="${sessionScope.currentOrder.status}" /></td>
      </tr>
    </table>
      <table class="total-table">
        <tr>
          <th>Item ID</th>
          <th>Description</th>
          <th>Quantity</th>
          <th>Price</th>
<%--          <th>Total Cost</th>--%>
        </tr>
        <c:forEach var="lineItem" items="${sessionScope.currentOrder.lineItems}">
          <tr>
            <td>

              <a href="itemForm?itemId=${lineItem.item.itemId}">${lineItem.item.itemId}</a>

            </td>
            <td>
              <c:if test="${lineItem.item != null}">
                ${lineItem.item.attribute1}
                ${lineItem.item.attribute2}
                ${lineItem.item.attribute3}
                ${lineItem.item.attribute4}
                ${lineItem.item.attribute5}
                ${lineItem.item.product.name}
              </c:if>
              <c:if test="${lineItem.item == null}">
                <i>{description unavailable}</i>
              </c:if>
            </td>

            <td>${lineItem.quantity}</td>
            <td><fmt:formatNumber value="${lineItem.unitPrice}"
                                  pattern="$#,##0.00" /></td>
<%--            <td><fmt:formatNumber value="${lineItem.total}"--%>
<%--                                  pattern="$#,##0.00" /></td>--%>
          </tr>
        </c:forEach>
        <tr>
          <th colspan="5">Total: <fmt:formatNumber
                  value="${sessionScope.currentOrder.totalPrice}" pattern="$#,##0.00" /></th>
        </tr>
      </table>
    <div style="text-align: center;">
      <a class="finalBtn">Confirm</a>
    </div>
  </div>
</div>
<script src="js/viewOrder.js"></script>
<%@ include file="../common/bottom.jsp"%>
